<template>
	<view>
		<hx-navbar ref="hxnb" :config="config"></hx-navbar>
		<view class="container">
			<view class="header">
				<view class="label">
					<text>批量设置价格</text>
				</view>
				<view class="view">
					<u--input class="input" border="surround"></u--input>
					<view class="unit">
						<text>元/ {{chargeUnit}}</text>
					</view>
					<view class="icon" @click="toPageChargeUnit">
						<u-icon name="edit-pen-fill" siez="25" color="#ff8383"></u-icon>
					</view>
				</view>
			</view>
			<view class="main">
				<view class="main_view">
					<view class="label">
						<text>1#</text>
					</view>
					<view class="view">
						<u--input class="input" border="surround"></u--input>
						<view class="unit">
							<text>元/ 米</text>
						</view>
						<view class="icon" @click="deleteClick">
							<u-icon name="trash" siez="25" color="#ff8383"></u-icon>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="button">
			<u-button type="primary" text="确定" @click="submit"></u-button>
		</view>
		<u-modal :show="deleteShow" title="你确认要删除 [3#] 吗?" showCancelButton @cancel="deleteShow = false"></u-modal>
	</view>
</template>

<script>
	export default {
		name: 'sales-offer-color-price',
		onLoad(options) {
			const {
				name,
				code
			} = options
			this.config.title = `${code} ${name}`
			
			uni.$on('on-selected-charge-unit', item => {
				console.log(item)
			})
		},
		data() {
			return {
				config: {
					title: "设置价格",
					color: "#ffffff",
					//背景颜色;参数一：透明度（0-1）;参数二：背景颜色（array则为线性渐变，string为单色背景）
					backgroundColor: [1, ["#409EFF", "#409EFF", "#60b4f6", "#60b4f6"]]
				},
				chargeUnit: '米',
				deleteShow: false
			}
		},
		methods: {
			toPageChargeUnit() {
				uni.navigateTo({
					url: "pages/selects/charge-unit/index"
				})
			},
			deleteClick() {
				this.deleteShow = true
			},
			submit() {
				uni.navigateTo({
					url: 'pages/application/pages/cloth/sales-quotation/index'
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.container {
		.main {
			margin-top: 20rpx;
		}
		
		.header, .main_view {
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 20rpx 30rpx;
			background-color: #fff;
			
			.label {
				font-size: 28rpx;
				color: #545454;
				letter-spacing: 1rpx;
			}
			
			.view {
				display: flex;
				align-items: center;
				.input {
					width: 220rpx;
				}
				
				.unit {
					margin: 0 20rpx;
					font-size: 30rpx;
					color: #515151;
					letter-spacing: 1rpx;
				}
				
				.icon {
					margin-left: 20rpx;
				}
			}
		}
	}
	
	.button {
		margin-top: 80rpx;
		width: 100%;
		padding: 20rpx;
		background-color: #fff;
	}
</style>